package com.palmwindActivity.app;

import com.palmwindActivity.R;
import com.palmwindActivity.app.main.MenuHandler;

import android.app.Activity;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;

public abstract class AbstractActivity extends Activity {

	public void onStart()
	{
		super.onStart();
		SharedPreferences preference = this.getSharedPreferences("releaseall", 0);
    	boolean isRelease = preference.getBoolean("isRelease", false);
    	if(isRelease)
    	{
    		finish();
    	}else
    	{
    		onStartDelegate();
    	}
	}

	protected abstract void onStartDelegate();
	
	 public boolean onCreateOptionsMenu (Menu menu)
	 {
	        MenuItem exitMenu = menu.add(0, MenuHandler.EXIT_ID, Menu.NONE, R.string.exit_str);
	        MenuHandler menuHandler = new MenuHandler(this);
	        exitMenu.setOnMenuItemClickListener(menuHandler);
	        return super.onCreateOptionsMenu(menu);
	 }
	 
}
